package com.sysu.dinner.service;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import com.sysu.dinner.dao.UserDAO;
import com.sysu.dinner.model.User;

@Component("userService")
public class UserService {
	private UserDAO userDao;
	
	public boolean isExist(String name,String phone){
		if(name!=null && phone != null)
			return userDao.isExist(name, phone);
		return false;
	}

	public int addUser(User user){
		if(user != null)
			return userDao.addUser(user);
		return 0;
	}
	
	public boolean isVaild(String name,String password,String phone) {
		if(name!=null && password!=null && phone!=null)
			return userDao.isValid(name, password, phone);
		return false;
	}
	
	@Resource
	public void setUserDao(UserDAO userDao) {
		this.userDao = userDao;
	}

	public UserDAO getUserDao() {
		return userDao;
	}
	
	

}
